<?php

class Application_Form_Category extends Zend_Form
{

    public function init()
    {
        //Hidden text field to pass id value
        //ID must be integer
        $id = new Zend_Form_Element_Hidden("id");
        $id->addFilter("Int");

        //Categories name
        $name = new Zend_Form_Element_Text("name");
        $name->setLabel("Nama Kategori:")
                ->setRequired("true")
                ->addFilter("StripTags")
                ->addFilter("StringTrim")
                ->addValidator("NotEmpty")
                ->setAttrib("maxLength", "25")
                ->addErrorMessages(array("NotEmpty" => "Mohon isi nama Kategori"));

       

        //Categories description/details
        $details = new Zend_Form_Element_TextArea("details");
        $details->setLabel("Masukan keterangan:")
             ->addFilter("StripTags")
             ->addFilter("StringTrim")
             ->setAttrib("cols","30")
             ->setAttrib("rows","5");

      
        //Submit button
        $submit = new Zend_Form_Element_Submit("submit");
        $submit->setAttrib("id","submit");

        //Reset button
        $reset = new Zend_Form_Element_Reset("reset");
        $reset->setAttrib("id","reset");

        //Add all elements to form
       $this->addElements(array($id,$name,$details,$submit,$reset));
    }


}

